function hanoi2(n) {
	func(n, 'left', 'right', 'mid')
}
function func(n, from, to, other) {
    if(n == 1) {
		console.log(`move 1 from ${from} to ${to}`)
        return
    }
    func(n-1, from, other, to)
	console.log(`move ${n} from ${from} to ${to}`)
    func(n-1, other, to, from)
}

hanoi2(3)